home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / Main.bin / KeyPair.java < prev    next >
Text File  |  1998-10-14  |  2KB  |  65 lines

  1. /*
  2.  * @(#)KeyPair.java    1.4 98/07/01
  3.  *
  4.  * Copyright 1995-1998 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  * 
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. package java.security;
  16.  
  17. import java.util.*;
  18. import java.io.*;
  19. /**
  20.  * <p>This class is a simple holder for a key pair (a public key and a
  21.  * private key). It does not enforce any security, and, when initialized, 
  22.  * should be treated like a PrivateKey.
  23.  *
  24.  * @see PublicKey
  25.  * @see PrivateKey
  26.  *
  27.  * @version 1.4 98/10/05
  28.  * @author Benjamin Renaud
  29.  */
  30. public final class KeyPair { 
  31.  
  32.     private PrivateKey privateKey;
  33.     private PublicKey publicKey;
  34.  
  35.     /**
  36.      * Constructs a key with the specified public key and private key.
  37.      * 
  38.      * @param publicKey the public key.
  39.      * 
  40.      * @param privateKey the private key.
  41.      */
  42.     public KeyPair(PublicKey publicKey, PrivateKey privateKey) {
  43.     this.publicKey = publicKey;
  44.     this.privateKey = privateKey;
  45.     }
  46.  
  47.     /**
  48.      * Returns the public key from this key pair.
  49.      * 
  50.      * @return the public key.
  51.      */
  52.     public PublicKey getPublic() {
  53.     return publicKey;
  54.     }
  55.  
  56.      /**
  57.      * Returns the private key from this key pair.
  58.      * 
  59.      * @return the private key.
  60.      */
  61.    public PrivateKey getPrivate() {
  62.     return privateKey;
  63.     }    
  64. }
  65.